<template>
<div class="commonBox" style="margin-right: 20px">
    <p>
        <span class="tit1">培训人员数量</span>
    </p>
    <div ref="chart1" class='top20' style="width: 100%; height: 400px" />
</div>
</template>

<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
export default {
    components: {},
    props: {},
    data() {
        return {
            chartData: {
                data1: ['志愿者', '从业者', '管理人员'],
                data2: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
                data3: [220, 182, 191, 234, 290, 330, 310, 191, 91, 191, 330, 310],
                data4: [120, 82, 91, 191, 234, 290, 330, 310, 134, 290, 330, 210],
                data5: [ 91, 191, 120, 82,234, 82, 91, 191, 134, 290, 91, 191],
            }
        }
    },
    computed: {},
    watch: {

    },
    created() {
        const t = this;

    },
    mounted() {
        const t = this;
        t.initChart();
    },
    methods: {
        initChart() {
            this.chart = echarts.init(this.$refs.chart1, 'macarons')
            this.setOptions()
        },
        setOptions() {
            const t = this;
            this.chart.setOption({
                color: ['#1BCDDB','#6079FF', '#FF5346'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        label: {
                            backgroundColor: '#6a7985'
                        }
                    }
                },
                legend: {
                    data: t.chartData.data1
                },
                grid: {
                    left: '3%',
                    right: '10%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [{
                    type: 'category',
                    boundaryGap: false,
                    data: t.chartData.data2
                }],
                yAxis: [{
                    type: 'value'
                }],
                series: [{
                        name: t.chartData.data1[0],
                        type: 'line',
                        
                        data: t.chartData.data3
                    },
                    {
                        name: t.chartData.data1[1],
                        type: 'line',
                       
                        data: t.chartData.data4
                    },
                    {
                        name: t.chartData.data1[2],
                        type: 'line',
                        data: t.chartData.data5
                    }
                ]
            })
        }
    }
}
</script>

<style lang="scss" scoped>
</style>
